package com.hospital.hospitalserver.controller;

import com.hospital.hospitalserver.entity.FinanceDetail;
import com.hospital.hospitalserver.service.FinanceService;
import com.hospital.hospitalserver.service.ProfessionService;
import com.hospital.hospitalserver.util.Pager;
import com.hospital.hospitalserver.util.Response;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * 财务人员管理相关API接口
 * */
@RestController
@CrossOrigin
@RequiredArgsConstructor
@RequestMapping("/finance")
public class FinanceController {
    private final FinanceService financeService;
    private final ProfessionService professionService;

    /**
     * 新增财务人员
     * */
    @PostMapping("/addFinance")
    public Response addFinance(@RequestBody FinanceDetail finance){
        return financeService.addFinance(finance);
    }

    /**
     * 编辑财务人员
     * */
    @PostMapping("/editFinance")
    public Response editFinance(@RequestBody FinanceDetail finance){
        return financeService.editFinance(finance);
    }

    /**
     * 分页功能
     * 装载财务人员分页数据信息给前端API
     * */
    @PostMapping("/getFinancePagerDataBySearch")
    public Response getFinancePagerDataBySearch(@RequestBody Pager pager){
        return financeService.getFinancePagerDataBySearch(pager);
    }

    /**
     * 获取财务人员列表数据
     * 用于检索
     * */
    @GetMapping("/getFinanceList")
    public Response getFinanceList(){
        return financeService.getFinanceList();
    }

    /**
     * 获取财务人员职称信息列表
     * */
    @GetMapping("/getFinanceProfessionList")
    public Response getFinanceProfessionList(){
        return professionService.getFinanceProfessionList();
    }
}
